﻿<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/qa-category.tld" prefix="cat"%>
<c:set var="catIdRight" value="${questiono.mrIaskCategory.id},"/>
<c:choose>
    <c:when test="${user_session.type == '1'}">
        <c:set value="true" var="adminRight" scope="request"/>
        <c:set value="true" var="userOnline" scope="request"/>
    </c:when>
    <c:when test="${user_session.type != '1' and user_session.isSuper == true and fn:contains(user_session.permissions,catIdRight)}">
        <c:set value="true" var="adminRight" scope="request"/>
        <c:set value="true" var="userOnline" scope="request"/>
    </c:when>
    <c:when test="${user_session.userId == questiono.mrIaskUser.id}">
        <c:set value="true" var="authorRight" scope="request"/>
        <c:set value="true" var="userOnline" scope="request"/>
    </c:when>
    <c:when test="${user_session.type != null}">
        <c:set value="true" var="userOnline" scope="request"/>
    </c:when>
</c:choose>
<!--navigation and category list-->
<script type="text/javascript" src="<%=request.getContextPath()%>/qa/js/catselect.js"></script>
<table width="720" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td width="600">
        <html:link page="/question.mrqa?action=list">MFer 职场</html:link><cat:catlinks objType="Q"/>
        </td>
        <c:if test="${userOnline == true}">
        <td align="center" width="70">
            <c:if test="${adminRight == true}">
                <c:if test="${questiono.state != '1' and questiono.state != '5'}">
                <html:link page="/question.mrqa?action=recommend" paramId="id" paramName="questiono" paramProperty="id">
                                    <img src="qa/images/mr-qa-recommend-icon.gif" border="0" alt="推荐" align="bottom"/>推荐
                </html:link>
                </c:if>
            </c:if>
            <c:if test="${questiono.state == '1' or questiono.state == '5'}">
                <c:if test="${adminRight == true}">
                <html:link page="/question.mrqa?action=unrecommend" paramId="id" paramName="questiono" paramProperty="id">
                                    <img src="qa/images/mr-qa-recommend-icon.gif" border="0" alt="取消推荐" align="bottom"/>取消推荐
                </html:link>
                </c:if>
            </c:if>
        <td>
        <td align="center" width="60">
            <html:link page="/mylink.mrqa?action=add" paramId="questionId" paramName="questiono" paramProperty="id">
                        <img src="qa/images/mr-qa-mylink-icon.gif" border="0" alt="收藏" align="bottom"/>收藏
            </html:link>
        <td>
        </c:if>
        <c:if test="${userOnline != true}">
            <c:if test="${questiono.state == '1' or questiono.state == '5'}">
        <td align="center" width="60">
                &nbsp;
        <td>
            </c:if>
        <td align="center" width="60" title="请登陆后收藏">
                <img src="qa/images/mr-qa-mylink-icon.gif" border="0" alt="收藏" align="bottom"/>收藏
        <td>
        </c:if>
        <td align="right" valign="bottom" width="80"><img src="qa/images/mr-qa-question-icon.gif" border="0" alt="主题" align="bottom"/></td>
    </tr>
</table>
<!--question body-->
<div style="background-color:#FAFCFC;width:720;padding:4px 4px 4px 4px;border-left:1px solid #ccc;border-top:1px solid #ccc;border-right:1px solid #ccc;">
    <table cellpadding="0" cellspacing="0" border="0" style="width:710;word-wrap:break-word;table-layout:fixed;">
        <tr>
            <td width="145" valign="top">
                <div>
                <span style="width:80;">
                <c:set var="user_id" value="${questiono.mrIaskUser.id}"/><html:link page="/user.mrqa?action=viewuserbyother" styleId="author" paramId="id" paramName="user_id"><b><c:out value="${questiono.mrIaskUser.loginName}"/></b></html:link>
                </span>
                <span>
                <c:if test="${not empty user_session}">
                <c:url value="/msg.mrqa" var="pmLink">
                    <c:param name="action" value="preadd"/>
                    <c:param name="toUserLoginName" value="${questiono.mrIaskUser.loginName}"/>
                </c:url>
                <a href="<c:out value="${pmLink}"/>" title="给我短信"><img src="qa/images/icon/pm.gif" border="0" alt="给我短信"/></a>
                </c:if>
                </span>
                </div>
                <c:out value="${questiono.mrIaskUser.userScore.title}"/>
                <br>
                <br>
                <fmt:formatDate value="${questiono.postDate}" var="postDate" type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
                <c:out value="${postDate}"/>
            </td>
            <td valign="top">
                <div style="padding-bottom:10px;">
                <c:if test="${questiono.state != '2' and questiono.state != '5'}">
                <img src="qa/images/mr-qa-simplequestion-icon.gif" border="0" alt="普通帖子" align="bottom"/>
                </c:if>
                <c:if test="${questiono.state == '2' or questiono.state == '5'}">
                <img src="qa/images/mr-qa-complicated-question-icon.gif" border="0" alt="加急帖子" align="bottom"/>
                </c:if>
                <b>
                	<c:if test="${questiono.titleAttribute != null}">
            				<span style="<c:out value="${questiono.titleAttribute}" />">
            			</c:if>
                	<c:out value="${questiono.title}" escapeXml="false"/> <c:if test="${questiono.isExpired == true}">(已过期)</c:if>
                	<c:if test="${questiono.titleAttribute != null}">
            				</span>
            			</c:if>
                </b>
                </div>
                <%pageContext.setAttribute("vEnter","\n");%>
                <div>
                    <c:set var="qcontent" value="${fn:replace(questiono.content,vEnter,'<br/>')}"/>
                    <c:set var="qcontent" value="${fn:replace(qcontent,'  ','&nbsp;&nbsp;')}"/>
                    <c:out escapeXml="false" value="${fn:replace(qcontent,'<image=','<img border=0 src=')}"/>
                </div>
                <c:if test="${not empty questiono.reference}">
                        <br><font color="#FFA500">参考:</font><a href="<c:out value="${questiono.reference}"/>" target="_blank"><c:out value="${questiono.reference}"/></a>
                </c:if>
                <c:if test="${not empty questiono.fileName}">
                        <br><font color="#FFA500">附件:</font>
                        <a href="<%=com.mr.qa.GlobalConfigs.UPLOADEDFILE_DIR%><c:out value="${questiono.file}"/>">
                            <c:out value="${questiono.fileName}"/>
                        </a>
                        (请谨慎判断文件类型,避免恶意侵扰,网站不负责可能造成的损坏或损失)
                </c:if>
                <c:if test="${not empty questiono.addition}">
                      <br>  
                      <font color="#FFA500">帖子补充：</font><br>  
                      <pre><c:out escapeXml="false" value="${questiono.addition}"/></pre>
                 </c:if>
                            <!--my supplement -->
                            <div id="questionsupplement" style="display:none">
                             <html:form action="/question" onsubmit="return supplementValidate(this);">
                                <html:hidden property="action" value="supplement"/>
                                <html:hidden property="id"/>
                                补充：<html:textarea property="addition" name="questiono" cols="60" rows="2"/><input type="submit" value="提交补充"/>
                             </html:form>
                             <script type="text/javascript">
                                function supplement(pLink)
                                {
                                    var questionsupplementDiv = document.getElementById("questionsupplement");
                                    if(questionsupplementDiv.style.display == "none")
                                        questionsupplementDiv.style.display = "block";
                                    else
                                        questionsupplementDiv.style.display = "none";
                                    return false;
                                }
                                function supplementValidate(pForm)
                                {
                                    var addition = pForm.addition.value;
                                    if(addition == "" || addition.length < 2)
                                    {
                                        alert("[补充]必须填写，必须大于2个字符");
                                        return false;
                                    }
                                    return true;
                                }
                             </script>
                            </div>
              <!--comment -->
              <c:if test="${fn:length(questiono.mrIaskComments) > 0}">
                <br>
                <div>
                        <span style="float:left;color:#FFA500;">对此帖子的评论:</span>
                        <span style="float:right;cursor:hand;color:red" onclick="expandComments();" id="commentsDivOpenIndicator" title="关闭"><img id="commentImgSwitchor" src="qa/images/ico_collapse.gif"/></span>
                </div>
                <div id="commentsDiv">
                    <br>          
                    <c:forEach var="comment" items="${questiono.mrIaskComments}">
                        <div style="padding-top:4px;">
                            <pre><c:out value="${comment.content}" escapeXml="false"/></pre>
                            <span style="float:left;">
                                <fmt:formatDate value="${comment.postDate}" var="postDate" type="both"/><c:out value="${postDate}"/>
                                <c:set var="comment_user_id" value="${comment.mrIaskUser.id}"/>
                                <html:link page="/user.mrqa?action=viewuserbyother" styleId="author" paramId="id" paramName="comment_user_id">
                                <c:out value="${comment.mrIaskUser.loginName}"/></html:link>
                            </span>
                            <span style="float:right;">
                                <c:if test="${user_session.userId == comment.mrIaskUser.id}">
                                    <html:link page="/comment.mrqa?action=delete" paramId="id" paramName="comment" paramProperty="id" title="删除评论后不能恢复">
                                        删除</html:link></c:if>
                                <c:if test="${user_session.userId != comment.mrIaskUser.id}">
                                    <c:if test="${adminRight == true}">
                                    <html:link page="/comment.mrqa?action=delete" paramId="id" paramName="comment" paramProperty="id"  title="删除评论后不能恢复">
                                        删除</html:link></c:if></c:if></span>
                        </div>
                        <hr>
                    </c:forEach>
                    <script type="text/javascript">
                        function expandComments()
                        {
                            var commentsDiv = document.getElementById("commentsDiv");
                            var commentsDivOpenIndicator = document.getElementById("commentsDivOpenIndicator");
                            var imgSwitchor = document.getElementById("commentImgSwitchor");
                            if(commentsDiv.style.display == "none")
                            {
                                commentsDiv.style.display = "block";
                                commentImgSwitchor.src = "qa/images/ico_collapse.gif";
                                commentsDivOpenIndicator.title = "关闭";
                            }
                            else
                            {
                                commentsDiv.style.display = "none";
                                commentImgSwitchor.src = "qa/images/ico_expand.gif";
                                commentsDivOpenIndicator.title = "展开";
                            }
                        }
                    </script>
                </div>
                </c:if>
                            <!--comment form-->
                            <div id="commentdiv" style="display:none">
                             <html:form action="/comment" onsubmit="return commentValidate(this);">
                                <html:hidden property="action" value="add"/>
                                <html:hidden property="subjectType" value="Q"/>
                                <input type="hidden" name="subjectId" value="<c:out value="${questiono.id}"/>"/>
                                评论：<html:textarea property="content" cols="60" rows="2"/><input type="submit" value="提交评论"/>
                             </html:form>
                             <script type="text/javascript">
                                function icomment(pLink)
                                {
                                    var commentDiv = document.getElementById("commentdiv");
                                    if(commentDiv.style.display == "none")
                                        commentDiv.style.display = "block";
                                    else
                                        commentDiv.style.display = "none";
                                    return false;
                                }
                                function commentValidate(pForm)
                                {
                                    var content = pForm.content.value;
                                    if(content == "" || content.length < 2)
                                    {
                                        alert("[评论]必须填写，必须大于2个字符");
                                        return false;
                                    }
                                    return true;
                                }
                             </script>
                            </div>    
            </td>
        </tr>
    </table>
<!-- function links to question -->
    <script type="text/javascript">
        function ianswer()
        {
                var addAnswerDiv = document.getElementById("addAnswerDiv");        
                if(addAnswerDiv.style.display == "none")
                    addAnswerDiv.style.display = "block";
                var modifyAnswerDiv = document.getElementById("modifyAnswerDiv");
                if(modifyAnswerDiv.style.display == "block")
                    modifyAnswerDiv.style.display = "none";
                var trainingDiv = document.getElementById("trainingDiv");
                if(trainingDiv != null)
                    if(trainingDiv.style.display == "block" || trainingDiv.style.display == "")
                        trainingDiv.style.display = "none";
                self.scrollTo(document.body.scrollWidth,document.body.scrollHeight);
                document.answer.content.focus();
        }
    </script>
<c:if test="${userOnline == true}">
    <table width="710" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td width="145" align="right">
                &nbsp;
            </td>
            <td align="left">
                <c:if test="${questiono.isExpired == false}">
                <img src="qa/images/applytraining.jpg" alt="在线报名" title="在线报名" onclick="itrain();" style="cursor:hand;"/>
                </c:if>&nbsp;
                <img src="qa/images/mr-qa-ianswer-button.gif" border="0" style="cursor:hand;" alt="我来回复" align="bottom" onclick="ianswer();"/>
            </td>
            <td height="35" align="right">
                <c:if test="${adminRight == true}">
                    <a href="#changecatanchor" onclick="changeQuestionCat();return false;" title="改变帖子分类">转移</a>
                    &nbsp;|&nbsp;
                    <c:if test="${questiono.state != '2' and questiono.state != '5'}">
                            <%request.setAttribute("curDate",new java.util.Date());%>
                            <c:set var="differ" value="${(curDate.time-questiono.postDate.time)/1000/60/60}"/>
                            <c:if test="${differ >= 24}">
                                <html:link page="/question.mrqa?action=complicate" paramId="id" paramName="questiono" paramProperty="id" title="此帖子超过24小时没有人回复,新帖子超过24小时没有回复可以设置为加急">
                                                加急
                                </html:link>
                                &nbsp;|&nbsp;
                            </c:if>
                    </c:if>
                    <c:if test="${questiono.state == '2' or questiono.state == '5'}">
                                <%request.setAttribute("curDate",new java.util.Date());%>
                                <c:set var="differ" value="${(curDate.time-questiono.postDate.time)/1000/60/60}"/>
                                <c:if test="${differ >= 24}">
                                    <html:link page="/question.mrqa?action=uncomplicate" paramId="id" paramName="questiono" paramProperty="id" title="此帖子超过24小时没有人回复,新帖子超过24小时没有回复可以设置为加急">
                                                    取消加急
                                    </html:link>
                                    &nbsp;|&nbsp;
                                </c:if>
                    </c:if>
                    <c:if test="${questiono.state != '4'}">
                                <html:link page="/question.mrqa?action=close" paramId="id" paramName="questiono" paramProperty="id" title="隐藏此帖子,避免别的用户看到（仅作者能看到此连接）,你也可以在[用户中心]重新打开此帖子">
                                隐藏
                                </html:link>
                                &nbsp;|&nbsp;
                    </c:if>
                    <c:if test="${questiono.state == '4'}">
                                <html:link page="/question.mrqa?action=reopen" paramId="id" paramName="questiono" paramProperty="id" title="重开此帖子,使别的用户看到（仅作者能看到此连接）">
                                重开
                                </html:link>
                                &nbsp;|&nbsp;                            
                    </c:if>
                            <a href="#modifyanchor" onclick="modifyQuestion();return false;" title=" 修改帖子">修改</a>
                            &nbsp;|&nbsp;
                            <html:link page="/question.mrqa?action=delete" paramId="id" paramName="questiono" paramProperty="id" title="帖子被删除后无法恢复">
                                删除
                            </html:link>
                            &nbsp;|&nbsp;
                            <html:link page="/question.mrqa?action=pretop" paramId="id" paramName="questiono" paramProperty="id" title="置顶操作">
                                <c:if test="${questiono.isTop == false and questiono.isSecondaryTop == false}">置顶</c:if>
                                <c:if test="${questiono.isTop == true or questiono.isSecondaryTop == true}">修改置顶</c:if>
                            </html:link>
                            &nbsp;|&nbsp;
                            <html:link page="/question.mrqa?action=requirelogin" paramId="id" paramName="questiono" paramProperty="id" title="仅登录用户才能查看">
                                <c:if test="${questiono.isRequireLogin == false}">置登</c:if>
                                <c:if test="${questiono.isRequireLogin == true}">取消置登</c:if>
                            </html:link>
                            &nbsp;|&nbsp;
                            <html:link page="/question.mrqa?action=lock" paramId="id" paramName="questiono" paramProperty="id" title="锁帖后,用户不能回复.解锁后,用户才能回复.">
                            <c:if test="${questiono.isLocked == false}">
                                锁帖
                            </c:if>
                            <c:if test="${questiono.isLocked == true}">
                                解锁
                            </c:if>
                            </html:link>
                            &nbsp;|&nbsp;
                            <c:if test="${questiono.mrIaskCategory.isTraining == true}">
                              <html:link page="/question.mrqa?action=expire" paramId="id" paramName="questiono" paramProperty="id" title="广告分类有效，设为过期后，帖子优先级也同时降低">  
                                <c:if test="${questiono.isExpired == true}">
                                    开放
                                </c:if>
                                <c:if test="${questiono.isExpired == false}">
                                    过期
                                </c:if>
                              </html:link>
                                &nbsp;|&nbsp;
                            </c:if>
                </c:if>
                <c:if test="${authorRight == true}">
                    <c:if test="${questiono.state != '2' and questiono.state != '5'}">
                            <%request.setAttribute("curDate",new java.util.Date());%>
                            <c:set var="differ" value="${(curDate.time-questiono.postDate.time)/1000/60/60}"/>
                            <c:if test="${differ >= 24}">
                                <html:link page="/question.mrqa?action=complicate" paramId="id" paramName="questiono" paramProperty="id" title="此帖子超过24小时没有人回复,新帖子超过24小时没有回复可以设置为加急">
                                                加急
                                </html:link>
                                &nbsp;|&nbsp;
                            </c:if>
                    </c:if>
                    <c:if test="${questiono.state == '2' or questiono.state == '5'}">
                                <%request.setAttribute("curDate",new java.util.Date());%>
                                <c:set var="differ" value="${(curDate.time-questiono.postDate.time)/1000/60/60}"/>
                                <c:if test="${differ >= 24}">
                                    <html:link page="/question.mrqa?action=uncomplicate" paramId="id" paramName="questiono" paramProperty="id" title="此帖子超过24小时没有人回复,新帖子超过24小时没有回复可以设置为加急">
                                                    取消加急
                                    </html:link>
                                    &nbsp;|&nbsp;
                                </c:if>
                    </c:if>
                    <html:link page="/question.mrqa?action=supplement" paramId="id" paramName="questiono" paramProperty="id" onclick="supplement(this);return false;" title="可以对你的帖子进行补充,以得到更好的答案（仅作者能看到此连接）">
                            补充
                    </html:link>
                    &nbsp;|&nbsp;
                    <a href="#modifyanchor" onclick="modifyQuestion();return false;" title=" 修改帖子">修改</a>
                        <%request.setAttribute("curDate",new java.util.Date());%>
                        <c:set var="differ" value="${(curDate.time-questiono.postDate.time)/1000/60/60}"/>
                        <c:if test="${differ <= 24}">
                            &nbsp;|&nbsp;                
                            <html:link page="/question.mrqa?action=delete" paramId="id" paramName="questiono" paramProperty="id" title="发帖子24小时内普通用户可以删除帖子,帖子被删除后无法恢复">
                                删除
                            </html:link>
                        </c:if>
                        &nbsp;|&nbsp;
                </c:if>
                <a href="#" onclick="icomment(this);return false;">评论</a><br>
            </td>
        </tr>
    </table>
</c:if>
<c:if test="${userOnline != true}">
    <table width="710" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td width="145" align="right">
                &nbsp;
            </td>
            <td align="left">
                <c:if test="${questiono.isExpired == false}">
                <img src="qa/images/applytraining.jpg" alt="在线报名" title="在线报名" onclick="itrain();" style="cursor:hand;"/>
                </c:if>&nbsp;
                <img src="qa/images/mr-qa-ianswer-button.gif" border="0" style="cursor:hand;" alt="我来回复" align="bottom" onclick="ianswer();"/>
            </td>
            <td>&nbsp;</td>
    </table>
</c:if>
<c:if test="${questiono.mrIaskUser.signature != ''}">
    <table width="710" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td style="text-indent:144px;" align="left" height="26">
                个人签名:&nbsp;&nbsp;<font color="blue"><c:out value="${questiono.mrIaskUser.signature}"/></font>
            </td>
        </tr>
    </table>
</c:if>
</div>
<!--  remove blog -->
<c:if test="${adminRight == true}">
<xml id="catsData">
      <cats id="cats">  
        <cat:insert type="D" categoryType="0"/>
      </cats>
</xml>
<div id="changeQuestionCatDiv" style="display:none;">
<a name="changecatanchor"/>
<br>
<table class="mars" cellpadding="0" cellspacing="0">
    <html:form action="/question" method="post" onsubmit="return validateChangQuestionCatForm(this);">
    <html:hidden property="action" value="changecat"/>
    <input type="hidden" name="catId" value="<c:out value="${questiono.mrIaskCategory.id}"/>"/>
    <input type="hidden" name="id" value="<c:out value="${questiono.id}"/>"/>
    <tr class="even">
        <td colspan="2" align="left"><b>转移帖子</b></td>
    </tr>
    <tr>
        <td align="right">分类</td>
        <td valign="top">
            <html:select property="cat1Id" multiple="true" size="15" onchange="selectedCat1Changed(this)">
            </html:select>
            <html:select property="cat2Id" multiple="true" size="15" onchange="selectedCat2Changed(this)">
                <html:option value="">选择分类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
            </html:select>
            <html:select property="cat3Id" multiple="true" size="15">
                <html:option value="">选择分类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html:option>
            </html:select>*
        </td>
    </tr>
    <tr class="even">
        <td align="right"></td>
        <td>
            <input type="submit" value="保存修改"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" onclick="changeQuestionCat();"/>
        </td>
    </tr>
    </html:form>
</table>
<script type="text/javascript">
    var questionfs = document.questionf;
    var actionCode;
    var questionForm;
    for(var i=0;i<questionfs.length;i++)
    {
        actionCode = questionfs[i].action.value;
        if(actionCode == "changecat")
        {
            questionForm = questionfs[i];
            break;
        }
    }
    try
    {
        if(questionForm != null)initSelect1(questionForm);
    }
    catch(err)
    {
        alert("初始化帖子分类出现异常："+err);
    }
    function changeQuestionCat()
    {
        var changeQuestionCatDiv = document.getElementById("changeQuestionCatDiv");
        if(changeQuestionCatDiv.style.display == "none")
        {
            changeQuestionCatDiv.style.display = "block";
            document.location.href = '#changecatanchor';
        }
        else
            changeQuestionCatDiv.style.display = "none";
        return false;
    }
    function validateChangQuestionCatForm(pForm)
    {
        var selectedCatIdValue = getSelectedCatIdValue(pForm);
        if(selectedCatIdValue == "")
        {
            alert("[分类]必须选择");
            return false;
        }
        pForm.catId.value = selectedCatIdValue;
        return true;    
    }
</script>
</div>
</c:if>
<c:if test="${adminRight == true or authorRight == true}">
    <a name="modifyanchor"/>
    <div id="questionDiv" style="display:none;">
        <br>
        <table class="mars" cellpadding="0" cellspacing="0">
            <html:form action="/question" method="post" enctype="multipart/form-data" onsubmit="return validateq(this);">
            <html:hidden property="action" value="modify"/>
            <input type="hidden" name="catId" value="<c:out value="${questiono.mrIaskCategory.id}"/>"/>
            <input type="hidden" name="id" value="<c:out value="${questiono.id}"/>"/>
            <tr class="even">
                <td colspan="2" align="left"><b>修改帖子</b></td>
            </tr>
            <tr>
                <td align="right" width="148">标题</td>
                <td>
                    <c:if test="${user_session.type == '1'}">
                    <html:text property="title" name="questiono" size="60" maxlength="60"/>*(最长60个字符)
                    </c:if>
                    <c:if test="${user_session.type != '1'}">
                    <html:text property="title" name="questiono" size="60" maxlength="40"/>*(最长40个字符)
                    </c:if>
                    <c:if test="${user_session.type == '1'}">
                    &nbsp;&nbsp;<html:checkbox property="isRequireLogin" name="questiono"/>要求登录才能查看
                    </c:if>
                </td>
            </tr> 
            <tr class="even">
                <td align="right" style="vertical-align: top">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td><jsp:include page="help-insertpicture.jsp?id=1"/></td>
                            <td valign="top" align="right">内容</td>
                        </tr>
                    </table>
                </td>
                <td>
                    <textarea name="content" cols="77" rows="15"><c:out value="${questiono.content}" escapeXml="true"/></textarea>
                </td>
            </tr>
            <tr>
                <td align="right">补充</td>
                <td>
                    <textarea name="addition" cols="77" rows="3"><c:out value="${questiono.addition}" escapeXml="true"/></textarea>
                </td>
            </tr>
            <tr class="even">
                <td align="right">参考</td>
                <td>
                    <html:text property="reference" name="questiono" size="100" maxlength="100"/>
                </td>
            </tr>
           <tr class="even">
                <td align="right">附件</td>
                <td>
                    <c:if test="${not empty questiono.fileName}">
                        原附件:
                         <a href="<%=com.mr.qa.GlobalConfigs.UPLOADEDFILE_DIR%><c:out value="${questiono.file}"/>">
                                <c:out value="${questiono.fileName}"/>
                         </a>
                        &nbsp;&nbsp;
                        <html:link page="/question.mrqa?action=deletefile" paramId="id" paramName="questiono" paramProperty="id">
                                删除
                        </html:link>
                        <br>
                    </c:if>
                    <html:file property="file" size="88"/>
                    <br>(附件不能超过5M;如果重新上载，原文件被删除.)
                </td>
            </tr>
            <tr>
                <td align="right"></td>
                <td>
                    <input type="submit" value="保存修改"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" onclick="modifyQuestion();"/>
                </td>
            </tr>
            </html:form>
        </table>
        <script type="text/javascript">
            function validateq(pForm)
            {
                var title = pForm.title.value;
                if(title == "" || title.length < 1)
                {
                    alert("[标题]必须填写，长度必须大于0");
                    pForm.title.focus();
                    return false;
                }
                var titleLengthValid = validateTitleLength(pForm.title.value,pForm.catId.value);
                if(!titleLengthValid)
                {
                    alert("[标题]不能大于60个字符");
                    pForm.title.focus();
                    return false;
                }
                return true;
            }
            
            /*
            *validate the title length as per category id
            */
            function validateTitleLength(title,catId)
            {
                var specialCats = "48,49,51,16,18,19";
                if(title.length <= 60)
                {
                    return true;
                }
                else if(specialCats.indexOf(catId) >= 0)
                {
                    return true;
                }
                return false;
            }
            /**
            *dispaly or open the div for displaying the form of question for modifying
            */
            function modifyQuestion()
            {
                var questionDiv = document.getElementById("questionDiv");
                if(questionDiv.style.display == "none")
                {
                    questionDiv.style.display = "block";
                    var questionfs = document.questionf;
                    var questionf;
                    for(var i=0;i<questionfs.length;i++)
                    {
                        if(questionfs[i].action.value == "modify")
                        {
                          questionf = questionfs[i];  
                          questionf.title.focus();
                          break;
                        }
                    }
                    //self.scrollTo(document.body.scrollWidth,document.body.scrollHeight/2);
                    document.location.href = "#modifyanchor";
                }
                else
                    questionDiv.style.display = "none";
                return false;
            }
        </script>
    </div>
</c:if>
<!-- question answers -->
<jsp:include page="questionanswers.jsp"/>
<c:if test="${questiono.isExpired == false}">
<div id="trainingDiv">
<br>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="720">
    <tr style="background:url(qa/images/dothline.gif) bottom;">
        <td width="720">
        &nbsp;&nbsp;&nbsp;&nbsp;<b>在线报名</b>
        </td>
    </tr>
</table>
<div id="trainingDivInner" style="width:720;padding:12px 4px 4px 4px;border-left:1px dotted #ccc;border-right:1px dotted #ccc;border-bottom:1px dotted #ccc;">
        <table width="571" cellpadding="0" cellspacing="0" border="0" align="right">
            <html:form action="/ta" onsubmit="return validateApp(this);">
            <input type="hidden" name="text1" value="申请"/>
            <input type="hidden" name="text2" value="来自协作网站"/>
            <input type="hidden" name="text3" value="培训"/>
            <input type="hidden" name="text4" value="相关培训信息发布连接"/>
            <input type="hidden" name="text5" value="先生"/>
            <input type="hidden" name="text6" value="小姐"/>
            <input type="hidden" name="loginNameLiteral" value="网站ID"/>
            <input type="hidden" name="nameLiteral" value="真实姓名"/>
            <input type="hidden" name="hpLiteral" value="手机"/>
            <input type="hidden" name="sexLiteral" value="性别"/>
            <input type="hidden" name="emailLiteral" value="电子邮件"/>
            <input type="hidden" name="companyLiteral" value="公司"/>
            <input type="hidden" name="concernsLiteral" value="留言"/>
            <html:hidden property="trainingId" value="${questiono.id}"/>
            <html:hidden property="trainingName" value="${questiono.title}"/>
            <html:hidden property="trainingCategoryId" value="${questiono.mrIaskCategory.id}"/>
            <tr>
                    <td align="right">网&nbsp;站&nbsp;I&nbsp;D:</td>
                    <td>
                    <html:text property="loginName" size="50" value="${user_session.loginName}" maxlength="12"/>
                    </td>
            </tr>
            <tr>
                    <td align="right">* 真实姓名:</td>
                    <td>
                    <html:text property="name" size="50" value="${user_session.name}" maxlength="20"/>
                    </td>
            </tr>
            <tr>
                    <td align="right">* 性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</td>
                    <td>
                    <html:radio property="sex" value="M"/>先生&nbsp;&nbsp;&nbsp;<html:radio property="sex" value="F"/>小姐
                    </td>
            </tr>
            <tr>
                    <td align="right">* 手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机:</td>
                    <td>
                    <html:text property="hp" value="${user_session.mobile}" size="50" maxlength="12"/>
                    </td>
            </tr>
            <tr>
                    <td align="right">* 公&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;司:</td>
                    <td>
                    <html:text property="company" value="" size="50" maxlength="50"/>
                    </td>
            </tr>
            <tr>
                    <td align="right">* 邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;件:</td>
                    <td>
                    <html:text property="email" value="${user_session.email}" size="50" maxlength="30"/>
                    </td>
            </tr>
            <tr>
                    <td align="right">留&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;言:</td>
                    <td>
                    <html:textarea property="concerns" cols="60" rows="8"/>
                    </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td><input type="submit" name="sentAppSubmitButt" value="确认报名"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重新填写"/>&nbsp;&nbsp;&nbsp;&nbsp;*项必须填写,留言不能超过300字</td>
            </tr>
            </html:form>
        </table>
</div>
    <script type="text/javascript">
        function itrain()
        {
                var addAnswerDiv = document.getElementById("addAnswerDiv");
                if(addAnswerDiv != null)
                    if(addAnswerDiv.style.display == "block" || addAnswerDiv.style.display == "")
                        addAnswerDiv.style.display = "none";
                var modifyAnswerDiv = document.getElementById("modifyAnswerDiv");
                if(modifyAnswerDiv != null)
                    if(modifyAnswerDiv.style.display == "block")
                        modifyAnswerDiv.style.display = "none";
                var trainingDiv = document.getElementById("trainingDiv");
                if(trainingDiv != null)
                    if(trainingDiv.style.display == "none")
                        trainingDiv.style.display = "block";
                self.scrollTo(document.body.scrollWidth,document.body.scrollHeight);
                document.taf.name.focus();
        }
    </script>
        <script type="text/javascript">
            function validateApp(pForm)
            {
                if(pForm.name.value == "")
                {
                    alert("[姓名]必须填写");
                    pForm.name.focus();
                    return false;
                }
                if(pForm.hp.value == "")
                {
                    alert("[手机]必须填写");
                    pForm.hp.focus();
                    return false;
                }
                if(pForm.company.value == "")
                {
                    alert("[公司]必须填写");
                    pForm.company.focus();
                    return false;
                }
                if(pForm.email.value == "")
                {
                    alert("[联系邮件]必须填写");
                    pForm.email.focus();
                    return false;
                }
                if(pForm.concerns.value != "" && pForm.concerns.value.length > 300)
                {
                    alert("[留言]不能超过300个字");
                    pForm.concerns.focus();
                    return false;
                }
                pForm.sentAppSubmitButt.value = "提交中...请稍等";
                pForm.sentAppSubmitButt.disabled = true;
                return true;
            }
            function turnonAppDiv()
            {
                var trainingAppDiv = document.getElementById("trainingAppDiv");
                if(trainingAppDiv.style.display == "none")
                {
                    trainingAppDiv.style.display = "block";
                    //document.location.href = '#changecatanchor';
                }
                else
                    trainingAppDiv.style.display = "none";
                return false;
            }
        </script>
    </c:if>
</div>
    <script type="text/javascript">
        function closeAnswerDiv()
        {
                var addAnswerDiv = document.getElementById("addAnswerDiv");
                var trainingDiv = document.getElementById("trainingDiv");
                if(addAnswerDiv != null && trainingDiv != null)
                {
                    if(addAnswerDiv.style.display == "block" || addAnswerDiv.style.display == "")
                        addAnswerDiv.style.display = "none";
                }
                /*
                var modifyAnswerDiv = document.getElementById("modifyAnswerDiv");
                if(modifyAnswerDiv != null)
                    if(modifyAnswerDiv.style.display == "block")
                        modifyAnswerDiv.style.display = "none";
                */
        }
        closeAnswerDiv();
    </script>
